package com.educhains.module.user.service;

import com.educhains.module.demo.vo.Page;
import com.educhains.module.user.vo.User;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author YuRun
 * @since 2017年8月19日
 */
public interface UserService {

    /**
     * Get user by email
     *
     * @param userEmail
     * @return
     */
    User getUserByEmail(String userEmail);

    /**
     * Add user
     *
     * @param user
     * @return
     */
    int addUser(User user);

    /**
     * Update user
     *
     * @param user
     * @return
     */
    int updateUserAuthority(User user);

    /**
     * get all user
     *
     * @return
     */
    List<User> selectUserList();

    /**
     * get  users
     *
     * @return
     */
    List<User> searchByEmail(String emailFragment);

    /**
     * Update user password
     *
     * @param user
     * @return
     */
    int updateUserPassword(User user);

    Page showUserPage(int pageNum);

    Page searchByEmailPage(int pageNum, String emailFragment);

    List<User> selectUserListLimit(int userNum, String type);


    int updateContributionByUserEmail(String userEmail, float contribution);


    /**
     * Method for login
     *
     * @param userEmail
     * @param userPassword
     * @param userSalt
     * @return
     */
    boolean login(String userEmail, String userPassword, String userSalt);

    int updateUserPhoto(User user);

    User selectUserById(String userId);
}